package com.taxigang.client.uibinder;


import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import com.taxigang.client.Session;
import com.taxigang.shared.TaxiCompanyInfo;

public class TaxiCompanyDetail extends Composite {

	private static TaxiCompanyDetailUiBinder uiBinder = GWT
	.create(TaxiCompanyDetailUiBinder.class);

	interface TaxiCompanyDetailUiBinder extends
	UiBinder<Widget, TaxiCompanyDetail> {
	}

	public TaxiCompanyDetail() {
		initWidget(uiBinder.createAndBindUi(this));
		confirmButton.setText("Confirm cab orderd");
		cancelButton.setText("Cancel");
	}

	@UiField
	Frame urlFrame;

	@UiField
	Panel urlDetail;

	@UiField
	Panel telDetail;

	@UiField
	Button confirmButton;

	@UiField
	Button cancelButton;



	public void set(TaxiCompanyInfo taxiCompanyInfo) {
		boolean mobile = Session.getInstance().getIsUserAgentMobile();
		if (taxiCompanyInfo.getUrl()!=null){
			// Add an image to the dialog
			if (!mobile){
				urlFrame.setWidth("1200px");
				urlFrame.setHeight("800px");
			} else {
				urlFrame.setWidth("380px");
				urlFrame.setHeight("400px");				
			}
			urlFrame.setUrl(taxiCompanyInfo.getUrl());
			urlDetail.setVisible(true);

		}else{
			if (taxiCompanyInfo.getTelNo()!=null){
				if (!mobile){
					urlFrame.setWidth("400px");
					urlFrame.setHeight("400px");
				}
			}
		}

	}

	public Button getConfirmButton(){
		return confirmButton;
	}
	public Button getCancelButton(){
		return cancelButton;
	}

}
